Properly return extents for hypervisor memory ops call
authordjm@kirby.fc.hp.com <djm@kirby.fc.hp.com>
Thu, 15 Sep 2005 16:53:34 +0000 (10:53 -0600)
committerdjm@kirby.fc.hp.com <djm@kirby.fc.hp.com>
Thu, 15 Sep 2005 16:53:34 +0000 (10:53 -0600)
Signed-off-by Kevin Tian <kevin.tian@intel.com>

xen/arch/ia64/xen/hypercall.c

index a21982a548927bf46a5a81fe4e626fd197442078..79d69db9965cd1f5fd510db6001158a2d61a7bfb 100644 (file)
@@ -14,6 +14,7 @@
 
 #include <asm/vcpu.h>
 #include <asm/dom_fw.h>
+#include <public/memory.h>
 
 extern unsigned long translate_domain_mpaddr(unsigned long);
 extern struct ia64_pal_retval xen_pal_emulator(UINT64,UINT64,UINT64,UINT64);
@@ -152,9 +153,25 @@ ia64_hypercall (struct pt_regs *regs)
                break;
 
            case __HYPERVISOR_memory_op:
-               //regs->r8 = do_dom_mem_op(regs->r14, regs->r15, regs->r16, regs->r17, regs->r18); 
                /* we don't handle reservations; just return success */
-               regs->r8 = regs->r16;
+               {
+                   struct xen_memory_reservation reservation;
+                   void *arg = regs->r15;
+
+                   switch(regs->r14) {
+                   case XENMEM_increase_reservation:
+                   case XENMEM_decrease_reservation:
+                       if (copy_from_user(&reservation, arg,
+                               sizeof(reservation)))
+                           regs->r8 = -EFAULT;
+                       else
+                           regs->r8 = reservation.nr_extents;
+                       break;
+                   default:
+                       regs->r8 = do_memory_op(regs->r14, regs->r15);
+                       break;
+                   }
+               }
                break;
 
            case __HYPERVISOR_event_channel_op: